/*************************************************************************************************************
						  Copyright (C), 2006-2022, Autostar Tech. Co., Ltd.		
                         -----------------------------------------------
* 	FileName:       DrvTime.h
* 	Description:	Here Descript the file main function 

* 	Author:         Yelinshan
* 	UpdateDate:     2024/5/18
* 	Version:        0.1.0 
    History:			

*************************************************************************************************************/
#ifndef _DRV_TIME_H_
#define _DRV_TIME_H_
/*************************************************************************************************************
										 	Include Files
*************************************************************************************************************/
#include "main.h"
/*************************************************************************************************************
										 	Local Function
*************************************************************************************************************/

/*************************************************************************************************************
                                         	Extern Function
*************************************************************************************************************/

/*************************************************************************************************************
										 	Macro
*************************************************************************************************************/


/*************************************************************************************************************
										 	Enumerate
*************************************************************************************************************/
#define OS_TICK  2		/*TIM Irq time*/
#define PERIOD_2MS  	2/OS_TICK
#define PERIOD_4MS  	4/OS_TICK
#define PERIOD_6MS  	6/OS_TICK
#define PERIOD_10MS  	10/OS_TICK
#define PERIOD_50MS  	50/OS_TICK
#define PERIOD_100MS  	100/OS_TICK
#define PERIOD_200MS  	200/OS_TICK
#define PERIOD_500MS  	500/OS_TICK
#define PERIOD_1S  		1000/OS_TICK

typedef enum
{
	TIM_CH0 = 0u,
  	TIM_CH1,
    TIM_CH2,
    TIM_CH3,
    TIM_CH4,
    TIM_CH5,
	TIM_CH_MAX
}EN_TIM_CHANEL;

typedef struct 
{		
	bool RunFlag;
	uint16_t Task2ms;
	uint16_t Task4ms;
	uint16_t Task6ms;
	uint16_t Task10ms;
	uint16_t Task50ms;
	uint16_t Task100ms;
	uint16_t Task200ms;
	uint16_t Task300ms;
	uint16_t Task500ms;
	uint16_t Task1s;

}ST_OS_TICK;
/*************************************************************************************************************
										 	Structure
*************************************************************************************************************/

/*************************************************************************************************************
										 	Static Varable
*************************************************************************************************************/

/*************************************************************************************************************
										 	Constant
*************************************************************************************************************/

extern void DrvTimeInit(void);
//extern void DrvTimeStart(EN_TIM_CHANEL TIM, uint_32 Time);
extern void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim);
extern void DrvTimeStart(EN_TIM_CHANEL ch);
extern void DrvTimeStop(EN_TIM_CHANEL ch);

#endif
